<?php 

    define('IN_ECS', true);
    require(dirname(__FILE__) . '/includes/init.php');
    require(ROOT_PATH . 'includes/lib_order.php');
    if($_SERVER['REMOTE_ADDR'] != '61.140.49.99') exit;
    echo "1<br />";

    /* 
    * 做假购买记录
    */
    $user_name_arr = array('chazalzhou','玲珑之家优优','tb57112878','微靥儿','蔷薇的秋天过去','alice50206148','liangjunbo_1206','专业捣浆糊','richardgfai','刘艳秋','罗汉果仁','hequyuyang','情人节的情人花','tdy228228','木子天虫','莫乞i夏','赵传冬','八区小白','loonger0','随梦','艺术5201314','讨厌向日葵籽却喜欢向日葵','逆战小坑坑','细微的花香','momolovexian','超级无敌可爱哼','jiaojiong','高野一','曦宝乐园','玺玺玺','婕婕包包','zhudi_zhu','突来的雪','燕文拉','fernando715','杯子酷爱啤酒','二个蛋蛋蛋','哈哈茜姐','12345wyw','陈巍柳霞','christine312','蓝莓蛋糕','波爷爷','逸修暮光','潇筱恋歌','aiduofei','淡然','暮暮暮歌','黑哥','ritagu86','笑走风雨春秋','九日木子2014','夜读逍遥','zhongzg00','罗翌罗翌','大雁北飞5','龙凤成祥哼','uuehy','楠楠爱萍','简单皎洁','烟呢梦梦','靖帝儿','张爽2007','wangjianxiny','靓帆的妈','张贺嘉琪','紫风偶过','琳妹妹','风竹立','firstwu1111','精豆妈','汤圆小蕾','图虫宝','小田螺1944','皮琴8','ttdcs','1号海绵宝宝2011','曾许诺','吖32','小兔子905','yy030217','zhimeilove','1996丁0315','重生','情系凡晨','缥缈彩云间','maeciama','colgatetb','kilye_07','胖子刀锋','棒棒糖女孩kefe','陶淘0510','tb14838178','cici1234562009','何东尼','鱼咪咪','xxw_0523','晴朗235','milanfang_2008','yaka摩小羯','叫我西兰花','tb4886_1990','wuyan_1980','猪妖妖','tb7020808_11','包子扣袋','蒋湘云7553','tb5056722_20','许海红','牛奶水蜜桃','xulin04260','暗香仙子','四月一日63','米老鼠吱吱','zhu的约定','angel_o_o_琦','懒人超越时空','地狱来的','去伪求真1026','清泉抑扬','千年老妖','广盛源99','木子小月69','成都小涛哥','往事如风','栀子花开','奈何桥、寂寞','红颜','祸水','爱情屁','重生','Wanwan','欧威','磅度123','ranga','小五叶s','搁浅亲亲亲','英法癫狂','昔洳洳','高春云86','微笑再甜','沈阿阿','燕落于林','夜雪尚白','邪魅儿21','宋嘉祺00','胡雅洁楠','巍巍闫','空景333','陈奕蓝棒','单纯的脸孔','角度视美','苏海棠','望楼1111','衣可新','青海曲梦乐','wxd123','qjffgj','小梦婷','婷婷123','小潘','挤吧阿','sdfa安安','王晓晓','莱奥112','好ui','圣诞vf','JB110','小可','wyc111','qwe啊','梦想家','啊道','GG','wangyiyi','央美我要上','SD12','阿萨，asd123','wuxiaohua','一个小格格','QQ萧山','sanaim','为沵写的旋律','暧硪你卜配','懂得了不舍','蓝色妖姬甜苩頭','自导自演兩嗰','素锦流香奈儿','云***下','高姿态loftystance','z***0','犀***q ','yangyangrenjuan','cty588494','梅西爸爸','绾***笑','闵***宁','wsxy152952953','z滚滚','真水无香1947','凭***c','tb0712_14','莫***4','w***6','长颈鹿winni','幻***想','鱼小翔与七米希','yating19901104','m***7','陈***华','韩***鸣','yangyangrenjuan','cty588494','梅西爸爸','绾***笑','闵***宁','wsxy152952953','z滚滚','真水无香1947');
        // zuojiajilu($goods_id = 555, $count = 100, $start_time = 1415548800, $end_time = 1415721600, $user_name_arr, $goods_number_one = 1, $goods_number_two=2);
    // exit;
    

    /* 做假记录函数
    * $goods_id   商品ID
    * $count      要加的记录总数
    * $start_time 记录范围开始时间
    * $end_time   记录范围结束时间
    * $user_name_arr  用户名随机数据
    * $goods_number_one  记录购买商品数量最小值
    * $goods_number_tow  记录购买商品数量最大值
    */

    function zuojiajilu($goods_id = 0,$count = 0, $start_time = 0, $end_time = 0, $user_name_arr = array(), $goods_number_one = 1, $goods_number_two = 1){
        if(!$goods_id) return false;
        $sql ="SELECT g.goods_id,g.goods_name,ga.attr_value AS goods_attr,g.goods_sku FROM " . $GLOBALS['ecs']->table('goods') . " g LEFT JOIN " . $GLOBALS['ecs']->table('goods_attr') . " ga ON ga.goods_id = g.goods_id AND attr_id = 1 WHERE g.goods_id = $goods_id";
        $arr = $GLOBALS['db']->getAll($sql);
        $goods_name = $arr[0]['goods_name'];
        $sql = "INSERT INTO " . $GLOBALS['ecs']->table('order_goods') . '(order_id, goods_id, goods_name, goods_sku, product_id,goods_number,goods_attr,market_price,goods_price,send_number,is_real,parent_id,is_gift,goods_attr_id,user_name,add_time) VALUES ';
        for($i=0;$i<$count;$i++){
            $goods_attr = $arr[rand(0,count($arr)-1)]['goods_attr'];
            $user_name = $user_name_arr[rand(0,count($user_name_arr)-1)];
            $add_time = rand($start_time,$end_time);
            $goods_number = rand($goods_number_one,$goods_number_two);
            if($i > 0) $sql .= ',';
            $sql .= "('0','$goods_id','$goods_name','0','0','$goods_number','$goods_attr','0.00','0.00','0','1','0','0','0','$user_name','$add_time')";
        }
        $GLOBALS['db']->query($sql);
    }
 ?>